AC_DEFUN([AX_C___DECLSPEC], [
  AC_CACHE_CHECK([for __declspec], [ax_cv___declspec],
    [AC_COMPILE_IFELSE(
      [AC_LANG_SOURCE([static int __declspec(noinline) foo(void);static int foo(void) {return 0;} int main() {return foo();}])],
      [ax_cv___declspec=yes], [ax_cv___declspec=no]
    )
  ])
  if test "x${ax_cv___declspec}" = "xyes"; then
    AC_DEFINE([HAVE___DECLSPEC], 1, [define if your compiler supports __declspec])
  fi
])

